﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CopyFileInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Information abuot Copying a File
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;
    using System.Xml.Serialization;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [CollaborisClass(
       Title = "Copy File Info",
       ReleaseStatus = ReleaseStatus.Beta,
       Summary = "An entity to capture information about a file to copy from one location (Source) to another (Destination).",
       UndoImplemented = true)]
    [Serializable]
    public class CopyFileInfo : WSSEntityBase
    {
        #region Fields (4) 

        private string destFile;
        private bool? overwriteInDestination;
        private bool? overwriteInSource;
        private bool? deleteInSource;
        private string sourceFile;

        #endregion Fields 

        #region Properties (4) 

        [CollaborisProperty(
             Summary = "Specifies the URL for the destination file.",
             Title = "Destination File Url",
             Example = @"${CurrentWeb.Url}/Pages/NewPage.aspx",
             Required = true,
             InputHint = InputHint.Url
        )]
        [XmlAttribute]
        public string DestinationFileUrl
        {
            get
            {
                return this.destFile;
            }

            set
            {
                this.destFile = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies whether to overwrite the file if it already exists at the destination URL.",
             Title = "Overwrite In Destination",
             Example = @"true",
             Required = false,
             InputHint = InputHint.Boolean,
             OutputProperty = false
        )]
        [XmlElement(IsNullable = true)]
        public bool? OverwriteInDestination
        {
            get
            {
                return this.overwriteInDestination;
            }

            set
            {
                this.overwriteInDestination = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies whether to overwrite in source.",
             Title = "Overwrite In Source",
             Example = @"false",
             Required = true,
             InputHint = InputHint.Boolean,
             Remarks = "This property will only be used if the copy process is reversed during an 'Undo'."
        )]
        [XmlElement(IsNullable = true)]
        public bool? OverwriteInSource
        {
            get
            {
                return this.overwriteInSource;
            }

            set
            {
                this.overwriteInSource = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies whether to remove the file from the source after it is copied to the destination.",
             Title = "Delete In Source",
             Example = @"true",
             Required = false,
             InputHint = InputHint.Boolean,
             Remarks = "If this property is 'True' this acts like a move, otherwise it's a copy."
        )]
        [XmlElement(IsNullable = true)]
        public bool? DeleteInSource
        {
            get
            {
                return this.deleteInSource;
            }

            set
            {
                this.deleteInSource = value;
            }
        }

        [CollaborisProperty(
             Summary = "Specifies the URL for the source file that is to be copied.",
             Title = "Source File Url",
             Example = @"${CurrentWeb.Url}/Pages/Default.aspx",
             Required = true,
             InputHint = InputHint.Url
        )]
        [XmlAttribute]
        public string SourceFileUrl
        {
            get
            {
                return this.sourceFile;
            }

            set
            {
                this.sourceFile = value;
            }
        }

        #endregion Properties 
    }
}